<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>Axios入门案例</title>
	</head>
	<body>
		<div id="app">
			<h1 align="center">Axios练习</h1>
			
		</div>
		<script src="../js/axios.js"></script>
		<!-- <script src="../js/vue.js"></script> -->
		<script>
			let url = "http://127.0.0.1:8090/axios/user"
			/* 
			 注意事项:
			 Axios将原来的嵌套结构改为链式加载
			 发起Ajax请求
			 1.GET请求获取数据
			 2.回调函数中的result,不是服务器的返回值,是promise对象
			 */
			// axios.get("http://127.0.0.1:8090/axios/user")
			// 	.then(function(result) {
			// 		console.log(result.data)
			// 	})

			// axios.get("http://127.0.0.1:8090/axios/user/68")
			// 	.then(function(result) {
			// 		console.log("根据id查询" + result.data)
			// 	})

			/* restFul风格实现业务传参 
			name/age 查询
			
			url:http://localhost:8090/axios/user
			
			*/
		   //模板字符串
		   let name='11112'
		   let age = 22
			axios.get(`${url}/${name}/${age}`)
			.then(function(result){
				console.log(result.data)
			})

		</script>
	</body>
</html>
